const express = require("express");
const deviceController = require("../controller/deviceController");
const authController = require("../controller/authController");

const router = express.Router();

router
  .route("/")
  .get(authController.protect, deviceController.getAllDevices)
  .post(authController.protect, deviceController.createDevice);
router
  .route("/:id")
  .get(authController.protect, deviceController.getDevice)
  .patch(authController.protect, deviceController.updateDevice)
  .delete(authController.protect, deviceController.deleteDevice);

// getDeviceFromRoomID
router
  .route("/getDevice/:room_id")
  .get(deviceController.getDeviceFromRoomID)//开始录制

// 连接设备
router
  .route("/record/:room_id")
  .get(authController.protect, deviceController.startRecord)//开始录制

router
  .route("/continueRecord/:room_id")
  .get(authController.protect, deviceController.continueRecord)//继续录制


router
  .route("/pauseRecord/:room_id")
  .get(authController.protect, deviceController.pauseRecord)//开始录制

router
  .route("/stopRecord/:room_id")
  .post(authController.protect, deviceController.endRecord)//停止录制并上传资源

router
  .route("/startRtmp/:room_id")
  .get(authController.protect, deviceController.startRTMP)//开始直播

router
  .route("/stopRtmp/:room_id")
  .post(authController.protect, deviceController.stopRtmp)//停止直播
// 设备批量
router
  .route("/multipleDevices")
  .post(authController.protect, deviceController.mutipleDevices)

router
  .route("/RtmpAddRecord/:room_id")
  .get(authController.protect, deviceController.RtmpAddRecord)//开始录播

router
  .route("/closeRtmpAddRecord/:room_id")
  .post(authController.protect, deviceController.closeRtmpAddRecord)//停止录播并上传资源

// checkAndGetDeviceID
router
  .route("/checkConnect")
  .post(authController.protect, deviceController.checkAndGetDeviceID)//获取设备ID

module.exports = router;
